<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Đặng Khánh Trung
 * Date: 11/2/12
 * Time: 11:33 AM
 * To change this template use File | Settings | File Templates.
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$document = JFactory::getDocument();

$hosocanbos = $this->get('khenthuong');
$phong = $this->get('phong');
$donvis = $this->get('donvi');
if (count($donvis) > 1)
    $donvi = $donvis[0];
elseif (count($donvis) == 1)
    $donvi = $donvis;
$khoi = $this->get('khoi');
$phonglanhdao = VastHelper::getPhongLanhDao();
if (!($phonglanhdao->phongid == JRequest::getInt('phongid')))
{
    JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_vast&view=vast'));                
}

?>

<div id="crumbs">
    <div style="color: #222222;font-weight: normal;margin: 0;padding: 0">
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=vast') ?>">Trang chủ</a> »
        <span>Cơ cấu tổ chức</span> »
        <?php if (isset($khoi)): ?>        
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=donvitructhuoc&id=' . $khoi->id); ?>"><?php echo $khoi->ten ?></a> »                
        <?php endif; ?>
        <?php if (isset($donvi)): ?>
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=phongtructhuocs&id=' . $donvi->id); ?>"><?php echo $donvi->ten ?></a> »
        <?php endif; ?>
        <?php if (isset($phong)): ?>
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=chitietphong&id=' . $phong->id); ?>"><?php echo $phong->ten ?></a> »        
        <?php endif; ?>
        <span>Xác lập báo cáo</span>
    </div>
</div>

<div id="main" class="home">
    <h3 class="title green">Lập báo cáo khen thưởng của phòng <?php echo $phong->ten; ?></h3>
        
    <div class="single">
        <table id="rounded-corner">
            <thead>
                <tr>
                    <th scope="col" class="rounded-company"><a href="#hoten">Họ tên</a></th>
                    <th scope="col" class="rounded-q1"><a href="#ngaysinh">Ngày sinh</a></th>
                    <th scope="col" class="rounded-q2"><a href="#lydo">Lý do khen thưởng</a></th>
                    <th scope="col" class="rounded-q3" style="width: 150px;"><a href="#ngayquyetdinh">Ngày quyết định</a></th>
                    <th scope="col" class="rounded-q4"><a href="#thudientu">Thư điện tử</a></th>
                </tr>    
            </thead>
            <tfoot>
                <tr>
                    <td colspan="4" class="rounded-foot-left">
                        <em>
                        </em>
                    </td>
                    <td class="rounded-foot-right" style="font-size: smaller;">
                    </td>
                </tr>
            </tfoot>
            <tbody>
                <?php if (count($hosocanbos) > 0) foreach ($hosocanbos as $hoso) { ?>
                    <tr>
                        <td><a href="<?php echo JRoute::_('index.php?option=com_vast&view=chitietcanbo&id=' . $hoso->id); ?>"><?= $hoso->hoten ?></a></td>
                        <td><?= date('d/m/Y', strtotime($hoso->ngaysinh)) ?></td>
                        <td><?= $hoso->lydo ?></td>
                        <td><?= date('d/m/Y', strtotime($hoso->ngayquyetdinh)) ?></td>
                        <td><?= $hoso->thudientu ?></td>
                    </tr>
                <?php } ?>
            </tbody>
        </table>
    </div>    
    <div style="float: left; width: 680px; margin-top: 5px;">
        <a style="left: 600px; position: relative;" href="<?php echo JRoute::_('index.php?option=com_vast&task=baocaophong.csvKhenThuongReport&phongid=' . JRequest::getInt('phongid')); ?>">
            <img src="<?php echo $this->baseurl . '/components/com_vast/assets/images/csv_text.png'; ?>" />
        </a>
        <a style="left: 610px; position: relative;" href="<?php echo JRoute::_('index.php?option=com_vast&task=baocaophong.excelKhenThuongReport&phongid=' . JRequest::getInt('phongid')); ?>">
            <img src="<?php echo $this->baseurl . '/components/com_vast/assets/images/excel.png'; ?>" />                            
        </a>
        <a style="left: 620px; position: relative;" href="<?php echo JRoute::_('index.php?option=com_vast&task=baocaophong.pdfKhenThuongReport&phongid=' . JRequest::getInt('phongid')); ?>">
            <img src="<?php echo $this->baseurl . '/components/com_vast/assets/images/filetype_pdf.png'; ?>" />                            
        </a>                    
    
    </div>        
    <div style="float: left; width: 680px; margin-top: 5px;">
        <?php
        if (isset($_SERVER['HTTP_REFERER']))
        {
            $url = htmlspecialchars($_SERVER['HTTP_REFERER']);
            echo '<a title="Quay lại" href="' . $url . '"><span style="left: 610px; position: relative;">&laquo; Quay lại</span></a>';            
        }
        ?>    
    </div>    
</div>